package com.huarui.quotation.action;

import java.util.List;
import net.sf.json.JSONArray;
import org.ewaf.framework.action.BaseAction;
import com.huarui.area.cash.AreaCashBean;
import com.huarui.dictionary.DictionaryEnum;
import com.huarui.dictionary.model.Dictionary;
import com.huarui.dictionary.service.DictionaryReadOnlyService;


public class QuotationInputAction extends BaseAction {
	
	private static final long serialVersionUID = -2140087477067347409L;
	
	private DictionaryReadOnlyService dictionaryReadOnlyService;
	/**
	 * 来源详细组合
	 */
	private String joSources;
	/**
	 * 运输方式组合
	 */
	private String joTransportType;
	/**
	 * 地区信息组合
	 */
	private String joAreas;
	/**
	 * 支付方式
	 */
	private String joPayTypes;
	
	
	public String getJoPayTypes() {
		return joPayTypes;
	}

	public void setJoPayTypes(String joPayTypes) {
		this.joPayTypes = joPayTypes;
	}

	public String getJoSources() {
		return joSources;
	}

	public void setJoSources(String joSources) {
		this.joSources = joSources;
	}

	public String getJoTransportType() {
		return joTransportType;
	}

	public void setJoTransportType(String joTransportType) {
		this.joTransportType = joTransportType;
	}

	public String getJoAreas() {
		return joAreas;
	}

	public void setJoAreas(String joAreas) {
		this.joAreas = joAreas;
	}

	public void setDictionaryReadOnlyService(
			DictionaryReadOnlyService dictionaryReadOnlyService) {
		this.dictionaryReadOnlyService = dictionaryReadOnlyService;
	}
	
	public String toInput() {
		List<Dictionary> source_list = this.dictionaryReadOnlyService.getDictionaryByGroup(DictionaryEnum.GROUP_SOURCE);
		JSONArray source_ja = JSONArray.fromObject(source_list);
		this.joSources = source_ja.toString();
//		System.out.println(this.joSources);
		List<Dictionary> tran_list = this.dictionaryReadOnlyService.getDictionaryByGroup(DictionaryEnum.GROUP_TRANSPORT_TYPE);
		JSONArray tran_ja = JSONArray.fromObject(tran_list);
		this.joTransportType = tran_ja.toString();
		List<Dictionary> pay_list = this.dictionaryReadOnlyService.getDictionaryByGroup(DictionaryEnum.GROUP_PAY_TYPE);
		JSONArray pay_ja = JSONArray.fromObject(pay_list);
		this.joPayTypes = pay_ja.toString();
		this.joAreas = AreaCashBean.getAREA_MESS_JSON().toString();
		return "to_input";
	}
}
